﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WebApplication5.Common;
using WebApplication5.Models;

namespace WebApplication5.Data
{
    public class DbInitializer
    {
        public static async Task SeedAsync(MySqlDbContext context)
        {
            try
            {
                if (AppSettings.app(new string[] { "AppSettings", "SeedDB" }).ObjToBool())
                {
                    ConsoleHelper.WriteInfoLine("开始重置数据库...");
                    await context.Database.EnsureDeletedAsync();
                    await context.Database.EnsureCreatedAsync();
                    ConsoleHelper.WriteSuccessLine("数据库重置成功!");
                }
                if (AppSettings.app(new string[] { "AppSettings", "SeedDBData" }).ObjToBool())
                {
                    ConsoleHelper.WriteInfoLine("开始初始化数据...");

                    if (!context.courses.Any())
                    {
                        var news = new News[]
                        {
                            new News{ NewsId = "0011", Content = "湖北大学与青山区教育局、武钢实验学校共建师范生实习实训基地", Writer = "XXX", Date = "2021.9.8", Delete = "False"},
                            new News{ NewsId = "0012", Content = "湖北大学孝感校友会举行换届大会", Writer = "XXX", Date = "2021.9.10", Delete = "False"},
                            new News{ NewsId = "0013", Content = "我校教师李欣率领湖北队获全运会五人制足球赛冠军", Writer = "XXX", Date = "2021.9.11", Delete = "False"},
                            new News{ NewsId = "0014", Content = "校党委理论学习中心组开展2021年第13次集体学习", Writer = "XXX", Date = "2021.9.19", Delete = "False"},
                            new News{ NewsId = "0015", Content = "湖北大学珠海校友会正式成立", Writer = "XXX", Date = "2021.9.30", Delete = "False"},
                            new News{ NewsId = "0016", Content = "2021年国际学生开学典礼举行", Writer = "XXX", Date = "2021.10.1", Delete = "False"},
                            new News{ NewsId = "0017", Content = "我校余日季教授团队荣获XR创新应用全球挑战赛银奖", Writer = "XXX", Date = "2021.10.2", Delete = "False"},
                            new News{ NewsId = "0018", Content = "【党风廉政教育】全校171名纪检干部集中培训提升履职能力", Writer = "XXX", Date = "2021.10.8", Delete = "False"},
                            new News{ NewsId = "0019", Content = "庆祝湖北大学办学90周年志愿者动员培训大会举行", Writer = "XXX", Date = "2021.10.9", Delete = "False"},
                            new News{ NewsId = "0020", Content = "校长刘建平会见随州市政府副市长刘军伟一行", Writer = "XXX", Date = "2021.10.15", Delete = "False"},
                            new News{ NewsId = "0021", Content = "第五届能源材料和纳米技术国际会议（能源与环境材料）预告", Writer = "XXX", Date = "2021.10.19", Delete = "False"},
                            new News{ NewsId = "0022", Content = "湖北大学建校九十周年专场学术报告预告（9月13日-9月19日）", Writer = "XXX", Date = "2021.9.2", Delete = "False"},
                            new News{ NewsId = "0023", Content = "生物多样性保护与国家公园建设国际研讨会预告", Writer = "XXX", Date = "2021.10.28", Delete = "False"},
                            new News{ NewsId = "0024", Content = "“纪念黄邦和先生系列学术讲座”拉开帷幕", Writer = "XXX", Date = "2021.9.30", Delete = "False"},
                            new News{ NewsId = "0025", Content = "湖北大学建校九十周年专场学术报告预告（9月20日-9月26日）", Writer = "XXX", Date = "2021.9.3", Delete = "False"},
                            new News{ NewsId = "0026", Content = "2021年智能生物制造的研发与应用高级研修班在校举办", Writer = "XXX", Date = "2021.9.10", Delete = "False"},
                        };
                        var majors = new Major[]
                        {
                            new Major{ MajorId = "080902", CollegeId = "04", MajorName = "软件工程", MajorNumber = 153},
                            new Major{ MajorId = "080901", CollegeId = "04", MajorName = "计算机科学与技术", MajorNumber = 133},
                            new Major{ MajorId = "120202", CollegeId = "03", MajorName = "市场营销", MajorNumber = 142},
                            new Major{ MajorId = "083001", CollegeId = "08", MajorName = "生物工程", MajorNumber = 103},
                            new Major{ MajorId = "050101", CollegeId = "01", MajorName = "汉语言文学", MajorNumber = 96},
                            new Major{ MajorId = "040205", CollegeId = "05", MajorName = "运动人体科学", MajorNumber = 162},
                            new Major{ MajorId = "080904", CollegeId = "04", MajorName = "信息安全", MajorNumber = 183},
                            new Major{ MajorId = "080905", CollegeId = "04", MajorName = "物联网工程", MajorNumber = 166},
                            new Major{ MajorId = "050201", CollegeId = "07", MajorName = "英语", MajorNumber = 175},
                            new Major{ MajorId = "060101", CollegeId = "02", MajorName = "历史学", MajorNumber = 135}
                        };
                        var classes = new Classes[]
                        {
                            new Classes{ ClassId = "15385", Grade = "2019", ClassName = "软件工程1901", MajorId = "080902", JobNumber = "200009", Monitor = "李周龙", ClassSize = 45 },
                            new Classes{ ClassId = "52985", Grade = "2019", ClassName = "软件工程1902", MajorId = "080902", JobNumber = "200016", Monitor = "马德文", ClassSize = 46 },
                            new Classes{ ClassId = "68297", Grade = "2019", ClassName = "计算机科学与技术1901", MajorId = "080901", JobNumber = "200003", Monitor = "刘俊", ClassSize = 49 },
                            new Classes{ ClassId = "31857", Grade = "2019", ClassName = "计算机科学与技术1902", MajorId = "080901", JobNumber = "200007", Monitor = "周常军", ClassSize = 50 },
                            new Classes{ ClassId = "08749", Grade = "2019", ClassName = "市场营销1901", MajorId = "120202", JobNumber = "200006", Monitor = "赵洲", ClassSize = 46 },
                            new Classes{ ClassId = "36528", Grade = "2019", ClassName = "生物工程1903", MajorId = "083001", JobNumber = "200017", Monitor = "王伟民", ClassSize = 52 },
                            new Classes{ ClassId = "75958", Grade = "2019", ClassName = "汉语言文学1901", MajorId = "050101", JobNumber = "200018", Monitor = "李刚", ClassSize = 43 },
                            new Classes{ ClassId = "35260", Grade = "2019", ClassName = "运动人体科学1901", MajorId = "040205", JobNumber = "200020", Monitor = "朱小雨", ClassSize = 49 },
                            new Classes{ ClassId = "14673", Grade = "2019", ClassName = "计算机科学与技术1903", MajorId = "080901", JobNumber = "200008", Monitor = "李昌", ClassSize = 48 },
                            new Classes{ ClassId = "36985", Grade = "2019", ClassName = "物联网工程1902", MajorId = "080905", JobNumber = "200012", Monitor = "王爱民", ClassSize = 50 },
                        };
                        var students = new Student[]
                        {
                            new Student{ StuNumber = "2019001", ClassId = "31857", Name = "倪锦辉", Age = 20, Sex = "M", Grade = "2019", Address = "湖北武汉", Contact = "19421063637", CreditED = 38, CreditING = 8, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北武汉",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "8541258514@qq.com", MajorId = "080901", DormAddress = "二期B-121", EmergencyNumber = "16725497705", State = "True", Remarks = ""},
                            new Student{ StuNumber = "2019002", ClassId = "08749", Name = "朱元章", Age = 22, Sex = "M", Grade = "2019", Address = "湖北荆州", Contact = "19421063638", CreditED = 40, CreditING = 7, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北荆州",Political = "群众", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "3652514895@qq.com", MajorId = "120202", DormAddress = "二期B-102", EmergencyNumber = "18945184650", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019003", ClassId = "75958", Name = "皮晓洁", Age = 21, Sex = "W", Grade = "2019", Address = "湖北宜昌", Contact = "19421063639", CreditED = 39, CreditING = 6, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北宜昌",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "35695241587@qq.com", MajorId = "050101", DormAddress = "二期B-113", EmergencyNumber = "186451315461", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019004", ClassId = "52985", Name = "马德文", Age = 20, Sex = "M", Grade = "2019", Address = "陕西西安", Contact = "19421063640", CreditED = 37, CreditING = 4, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "陕西西安",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "15852689547@qq.com", MajorId = "080902", DormAddress = "三期A-321", EmergencyNumber = "139854778056", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019005", ClassId = "68297", Name = "刘骏", Age = 21, Sex = "M", Grade = "2019", Address = "湖北武汉", Contact = "19421063641", CreditED = 36, CreditING = 6, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北武汉",Political = "入党积极分子", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "6496564654@qq.com", MajorId = "080901", DormAddress = "二期B-312", EmergencyNumber = "15365228056", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019006", ClassId = "35260", Name = "朱小雨", Age = 20, Sex = "W", Grade = "2019", Address = "河南郑州", Contact = "19421063642", CreditED = 39, CreditING = 7, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "河南郑州",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "6555525895@qq.com", MajorId = "040205", DormAddress = "二期B-119", EmergencyNumber = "16734859730", State = "True", Remarks = ""},
                            new Student{ StuNumber = "2019007", ClassId = "14673", Name = "徐柏玉", Age = 21, Sex = "W", Grade = "2019", Address = "湖北武汉", Contact = "19421063643", CreditED = 40, CreditING = 6, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北武汉",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "3569874128@qq.com", MajorId = "080901", DormAddress = "三期A-119", EmergencyNumber = "13079130434", State = "True", Remarks = ""},
                            new Student{ StuNumber = "2019008", ClassId = "31857", Name = "杜袅袅", Age = 21, Sex = "W", Grade = "2019", Address = "湖北武汉", Contact = "19421063644", CreditED = 38, CreditING = 8, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北武汉",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "7854962153@qq.com", MajorId = "080901", DormAddress = "二期B-417", EmergencyNumber = "16857480260", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019009", ClassId = "68297", Name = "钱多多", Age = 20, Sex = "W", Grade = "2019", Address = "湖北荆门", Contact = "19421063645", CreditED = 35, CreditING = 6, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北荆门",Political = "群众", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "6461845725@qq.com", MajorId = "080901", DormAddress = "二期B-118", EmergencyNumber = "13628742020", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019010", ClassId = "75958", Name = "李寻欢", Age = 20, Sex = "M", Grade = "2019", Address = "湖北襄阳", Contact = "19421063646", CreditED = 36, CreditING = 7, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北襄阳",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "7364859308@qq.com", MajorId = "050101", DormAddress = "二期B-212", EmergencyNumber = "13697586177", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019011", ClassId = "08749", Name = "赵洲", Age = 20, Sex = "W", Grade = "2019", Address = "湖北武汉", Contact = "19421063647", CreditED = 38, CreditING = 6, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北武汉",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "7402284923@qq.com", MajorId = "120202", DormAddress = "三期A-121", EmergencyNumber = "13576828378", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019012", ClassId = "31857", Name = "周常军", Age = 22, Sex = "M", Grade = "2019", Address = "湖南长沙", Contact = "19421063648", CreditED = 39, CreditING = 7, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖南长沙",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "3820452523@qq.com", MajorId = "080901", DormAddress = "三期A-403", EmergencyNumber = "12871625862", State = "True", Remarks = ""},
                            new Student{ StuNumber = "2019013", ClassId = "14673", Name = "周洋", Age = 21, Sex = "M", Grade = "2019", Address = "湖南常德", Contact = "19421063649", CreditED = 37, CreditING = 9, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖南常德",Political = "入党积极分子", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "3614025654@qq.com", MajorId = "080901", DormAddress = "二期B-318", EmergencyNumber = "13582654702", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019014", ClassId = "36985", Name = "李治", Age = 21, Sex = "M", Grade = "2019", Address = "湖南张家界", Contact = "19421063650", CreditED = 38, CreditING = 8, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖南张家界",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "6125656634@qq.com", MajorId = "080905", DormAddress = "二期B-210", EmergencyNumber = "16885710529", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019015", ClassId = "15385", Name = "李周龙", Age = 22, Sex = "M", Grade = "2019", Address = "湖北武汉", Contact = "19421063651", CreditED = 35, CreditING = 8, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北武汉",Political = "入党积极分子", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "5158146040@qq.com", MajorId = "080902", DormAddress = "二期B-222", EmergencyNumber = "15205478022", State = "True", Remarks = ""},
                            new Student{ StuNumber = "2019016", ClassId = "14673", Name = "李昌", Age = 20, Sex = "M", Grade = "2019", Address = "湖北随州", Contact = "19421063652", CreditED = 36, CreditING = 6, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北随州",Political = "入党积极分子", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "6548986450@qq.com", MajorId = "080901", DormAddress = "三期A-319", EmergencyNumber = "14785920240", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019017", ClassId = "36528", Name = "王伟民", Age = 22, Sex = "M", Grade = "2019", Address = "湖北宜昌", Contact = "19421063653", CreditED = 38, CreditING = 4, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北宜昌",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "3124480337@qq.com", MajorId = "083001", DormAddress = "二期B-222", EmergencyNumber = "16285024395", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019018", ClassId = "75958", Name = "李刚", Age = 21, Sex = "M", Grade = "2019", Address = "湖北宜昌", Contact = "19421063654", CreditED = 32, CreditING = 9, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北宜昌",Political = "入党积极分子", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "40452483788@qq.com", MajorId = "050101", DormAddress = "二期B-422", EmergencyNumber = "13585269504", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019019", ClassId = "36985", Name = "王爱民", Age = 20, Sex = "W", Grade = "2019", Address = "湖北武汉", Contact = "19421063655", CreditED = 34, CreditING = 8, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北武汉",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "9810237254@qq.com", MajorId = "080905", DormAddress = "二期B-210", EmergencyNumber = "14205298547", State = "False", Remarks = ""},
                            new Student{ StuNumber = "2019020", ClassId = "36985", Name = "汪国伟", Age = 21, Sex = "M", Grade = "2019", Address = "湖北武汉", Contact = "19421063656", CreditED = 33, CreditING = 9, CreditNEED = 50, SchoolSituation = "", EntranceTime = "2019.9.1", Graduation = "False", NativePlace = "湖北武汉",Political = "共青团员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "18759245158@qq.com", MajorId = "080905", DormAddress = "三期A-311", EmergencyNumber = "13320458024", State = "False", Remarks = ""},
                        };
                        var teachers = new Teacher[]
                        {
                            new Teacher{ JobNumber = "200001",Name = "黄秋寒", Age = 33, Sex = "W", Address = "湖北武汉", Contact = "16842515219", NativePlace = "山东济南",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "已婚", Email = "851551728@qq.com", State = "True", CollegeId = "02", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 5, Remarks = "无"},
                            new Teacher{ JobNumber = "200002",Name = "张文强", Age = 21, Sex = "M", Address = "湖北武汉", Contact = "18515456319", NativePlace = "湖南长沙",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "685415228@qq.com", State = "False", CollegeId = "03", Wages = 2500, Title = "高级教师", Position = "教授", TeachingAge = 8, Remarks = "无"},
                            new Teacher{ JobNumber = "200003",Name = "郑龙", Age = 25, Sex = "M", Address = "湖北武汉", Contact = "17452152103", NativePlace = "湖北武汉",Political = "群众", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "1695872258@qq.com", State = "True", CollegeId = "06", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 6, Remarks = "无"},
                            new Teacher{ JobNumber = "200004",Name = "刘铁柱", Age = 40, Sex = "M", Address = "湖北武汉", Contact = "13851745692", NativePlace = "湖北宜昌",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "已婚", Email = "810975414@qq.com", State = "True", CollegeId = "07", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 5, Remarks = "无"},
                            new Teacher{ JobNumber = "200005",Name = "刘华强", Age = 32, Sex = "M", Address = "湖北武汉", Contact = "13685871475", NativePlace = "湖北黄石",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "939450865@qq.com", State = "False", CollegeId = "08", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 5, Remarks = "无"},
                            new Teacher{ JobNumber = "200006",Name = "曾香", Age = 21, Sex = "W", Address = "湖北武汉", Contact = "13378541526", NativePlace = "山东济宁",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "32532464323@qq.com", State = "False", CollegeId = "08", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 4, Remarks = "无"},
                            new Teacher{ JobNumber = "200007",Name = "刘浩", Age = 43, Sex = "M", Address = "湖北武汉", Contact = "16523518651", NativePlace = "江西南昌",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "离异", Email = "2328475836@qq.com", State = "False", CollegeId = "06", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 7, Remarks = "无"},
                            new Teacher{ JobNumber = "200008",Name = "陈楚琪", Age = 26, Sex = "W", Address = "湖北武汉", Contact = "15682485256", NativePlace = "湖北武汉",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "2342466455@qq.com", State = "False", CollegeId = "04", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 3, Remarks = "无"},
                            new Teacher{ JobNumber = "200009",Name = "李俊", Age = 35, Sex = "M", Address = "湖北武汉", Contact = "18854152585", NativePlace = "山东烟台",Political = "群众", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "2465345435@qq.com", State = "True", CollegeId = "06", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 6, Remarks = "无"},
                            new Teacher{ JobNumber = "200010",Name = "张燕", Age = 36, Sex = "W", Address = "湖北武汉", Contact = "16254258245", NativePlace = "湖北武汉",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "736584826@qq.com", State = "False", CollegeId = "02", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 7, Remarks = "无"},
                            new Teacher{ JobNumber = "200011",Name = "刘冰", Age = 27, Sex = "W", Address = "湖北武汉", Contact = "12138595468", NativePlace = "河北石家庄",Political = "群众", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "842574932@qq.com", State = "False", CollegeId = "01", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 3, Remarks = "无"},
                            new Teacher{ JobNumber = "200012",Name = "雷耀扬", Age = 42, Sex = "M", Address = "湖北武汉", Contact = "13596148525", NativePlace = "江西九江",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "5758764829@qq.com", State = "True", CollegeId = "10", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 6, Remarks = "无"},
                            new Teacher{ JobNumber = "200013",Name = "敖志坚", Age = 43, Sex = "M", Address = "湖北武汉", Contact = "16965861584", NativePlace = "湖北武汉",Political = "群众", Nationality = "中华人民共和国", Nation = "土家族", Marriage = "未婚", Email = "114462480@qq.com", State = "True", CollegeId = "05", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 10, Remarks = "无"},
                            new Teacher{ JobNumber = "200014",Name = "罗来俊", Age = 52, Sex = "M", Address = "湖北武汉", Contact = "13812284263", NativePlace = "河南郑州",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "456134570@qq.com", State = "False", CollegeId = "09", Wages = 2500, Title = "高级教师", Position = "教授", TeachingAge = 12, Remarks = "无"},
                            new Teacher{ JobNumber = "200015",Name = "胜春城", Age = 53, Sex = "M", Address = "湖北武汉", Contact = "16237526975", NativePlace = "湖北武汉",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "3492877159@qq.com", State = "False", CollegeId = "02", Wages = 2500, Title = "高级教师", Position = "教授", TeachingAge = 15, Remarks = "无"},
                            new Teacher{ JobNumber = "200016",Name = "陈雨婷", Age = 38, Sex = "W", Address = "湖北武汉", Contact = "17364237657", NativePlace = "山东省济南",Political = "群众", Nationality = "中华人民共和国", Nation = "藏族", Marriage = "未婚", Email = "8098762345@qq.com", State = "False", CollegeId = "07", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 5, Remarks = "无"},
                            new Teacher{ JobNumber = "200017",Name = "雷思怡", Age = 41, Sex = "W", Address = "湖北武汉", Contact = "12352833553", NativePlace = "湖北宜昌",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "6378911567@qq.com", State = "False", CollegeId = "09", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 4, Remarks = "无"},
                            new Teacher{ JobNumber = "200018",Name = "詹思琪", Age = 28, Sex = "W", Address = "湖北武汉", Contact = "13273467586", NativePlace = "湖北襄阳",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "96743457901@qq.com", State = "True", CollegeId = "10", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 3, Remarks = "无"},
                            new Teacher{ JobNumber = "200019",Name = "孙傲", Age = 33, Sex = "M", Address = "湖北武汉", Contact = "13124854634", NativePlace = "湖北武汉",Political = "群众", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "8575356898@qq.com", State = "False", CollegeId = "03", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 5, Remarks = "无"},
                            new Teacher{ JobNumber = "200020",Name = "钟慕轩", Age = 26, Sex = "M", Address = "湖北武汉", Contact = "16825418593", NativePlace = "湖北武汉",Political = "共产党员", Nationality = "中华人民共和国", Nation = "汉族", Marriage = "未婚", Email = "80985324@qq.com", State = "True", CollegeId = "04", Wages = 2500, Title = "高级教师", Position = "大学讲师", TeachingAge = 6, Remarks = "无"},
                        };
                        var users = new User[]
                        {
                            new User{ AccountNumber = "20482634", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20484627", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20622749", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20745259", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20786422", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20824529", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20836346", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20842807", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20844803", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20849244", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20874378", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20875284", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20927754", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20952594", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "20954723", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "22278674", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "22440349", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "22440762", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "22474397", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "22476244", Password = "123456", Identity ="Stu"},
                            new User{ AccountNumber = "22495336", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22497062", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22497502", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22572394", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22587242", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22674308", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22684724", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22694324", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22694822", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22803624", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22863948", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22943092", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22952574", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22405638", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22439255", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22475462", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22480336", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22534875", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22534952", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22657343", Password = "123456", Identity ="Teach"},
                            new User{ AccountNumber = "22744776", Password = "123456", Identity ="Admin"},
                            new User{ AccountNumber = "22794694", Password = "123456", Identity ="Admin"},
                            new User{ AccountNumber = "23049296", Password = "123456", Identity ="Admin"},
                            new User{ AccountNumber = "23269649", Password = "123456", Identity ="Admin"},
                            new User{ AccountNumber = "23546240", Password = "123456", Identity ="Admin"},
                        };
                        var systemLogs = new SystemLog[]
                        {
                            new SystemLog{ LogId = "0001", Changes = "更改录入错误的数据", Executor = "李宏文", Time = "2021.9.25"},
                            new SystemLog{ LogId = "0002", Changes = "更改选课系统状态", Executor = "李宏文", Time = "2021.9.25"},
                            new SystemLog{ LogId = "0003", Changes = "对学生数据进行补录", Executor = "李宏文", Time = "2021.9.26"},
                            new SystemLog{ LogId = "0004", Changes = "更改教师信息", Executor = "李宏文", Time = "2021.9.26"},
                            new SystemLog{ LogId = "0005", Changes = "对系统数据库的查询功能进行修改", Executor = "张统宇", Time = "2021.9.26"},
                            new SystemLog{ LogId = "0006", Changes = "对选课功能不能正常选上的错误进行修改", Executor = "张统宇", Time = "2021.9.27"},
                            new SystemLog{ LogId = "0007", Changes = "更改整体的数据库架构", Executor = "廖俊杰", Time = "2021.9.28"},
                            new SystemLog{ LogId = "0008", Changes = "添加新闻功能", Executor = "廖俊杰", Time = "2021.9.30"},
                            new SystemLog{ LogId = "0009", Changes = "创建新的主界面", Executor = "廖俊杰", Time = "2021.10.1"},
                            new SystemLog{ LogId = "0010", Changes = "对学院信息进行补充", Executor = "李宏文", Time = "2021.10.2"}
                        };
                        var jurisdictions = new Jurisdiction[]
                        {
                            new Jurisdiction{CourseSelectState = "False", SystemState = "False",DateTime=new DateTime()}
                        };
                        var colleges = new College[]
                        {
                            new College{CollegeId = "01",CollegeName = "湖北大学文学院", StuNumber = 204,TeachNumber = 38},
                            new College{CollegeId = "02",CollegeName = "湖北大学历史文化学院 ", StuNumber = 198,TeachNumber = 42},
                            new College{CollegeId = "03",CollegeName = "湖北大学商学院", StuNumber = 319,TeachNumber = 52},
                            new College{CollegeId = "04",CollegeName = "湖北大学计算机与软件工程学院", StuNumber = 583,TeachNumber = 85},
                            new College{CollegeId = "05",CollegeName = "湖北大学体育学院", StuNumber = 168,TeachNumber = 28},
                            new College{CollegeId = "06",CollegeName = "湖北大学资源环境学院", StuNumber = 204,TeachNumber = 36},
                            new College{CollegeId = "07",CollegeName = "湖北大学外国语学院", StuNumber = 218,TeachNumber = 41},
                            new College{CollegeId = "08",CollegeName = "湖北大学生命科学学院", StuNumber = 243,TeachNumber = 32},
                            new College{CollegeId = "09",CollegeName = "湖北大学化学化工学院", StuNumber = 310,TeachNumber = 48},
                            new College{CollegeId = "10",CollegeName = "湖北大学职业技术学院", StuNumber = 156,TeachNumber = 22}
                        };
                        var administrtors = new Administrator[]
                        {
                            new Administrator{Id = "01",Name = "LiHua"},
                            new Administrator{Id = "02",Name = "ZhouYang"},
                            new Administrator{Id = "03",Name = "LiaoYu"},
                            new Administrator{Id = "04",Name = "YangBai"},
                            new Administrator{Id = "05",Name = "ZhangSan"}
                        };
                        var courses= new Course[]
                        {
                        new Course{ CourseId = "001",CourseName = "高等数学",Credit = 5,Period = 80,CourseNature = "学科大类课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "002",CourseName = "汇编语言",Credit = 3,Period = 48,CourseNature = "专业方向课",CourseProperties = "专选课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "010",CourseName = "数字逻辑",Credit = 2,Period = 32,CourseNature = "专业方向课",CourseProperties = "专选课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "011",CourseName = "线性代数",Credit = 3,Period = 48,CourseNature = "学科大类课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "100",CourseName = "大数据导论",Credit = 2,Period = 32,CourseNature = "学科大类课",CourseProperties = "必修课",Inspect ="考查",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "210",CourseName = "离散数学",Credit = 3,Period = 48,CourseNature = "学科大类课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "159",CourseName = "计算机组成原理",Credit = 2,Period = 32,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "360",CourseName = "大学英语",Credit = 3,Period = 48,CourseNature = "通识教育课程平台",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "458",CourseName = "高级语言程序设计",Credit = 3,Period = 48,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "217",CourseName = "高级语言程序设计实验",Credit = 2,Period = 32,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考查",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "516",CourseName = "中国古代经济文化漫谈",Credit = 2,Period = 32,CourseNature = "通识教育课程平台",CourseProperties = "公选课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "421",CourseName = "词曲小说中的人生大爱",Credit = 2,Period = 32,CourseNature = "通识教育课程平台",CourseProperties = "公选课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "533",CourseName = "考古探险与世界古文明的再现",Credit = 2,Period = 32,CourseNature = "通识教育课程平台",CourseProperties = "公选课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "699",CourseName = "毛泽东思想和中国特色社会主义理论体系概论",Credit = 5,Period = 112,CourseNature = "通识教育课程平台",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "877",CourseName = "马克思主义基本原理",Credit = 5,Period = 112,CourseNature = "通识教育课程平台",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "753",CourseName = "心理学",Credit = 1,Period = 16,CourseNature = "通识教育课程平台",CourseProperties = "公选课",Inspect ="考试",TestWeight = 40,UsualWeight = 60 },
                        new Course{ CourseId = "521",CourseName = "大学语文",Credit = 3,Period = 48,CourseNature = "学科大类课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "611",CourseName = "大学计算机实验",Credit = 1,Period = 16,CourseNature = "专业核心课",CourseProperties = "选修课",Inspect ="考查",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "810",CourseName = "形而上学",Credit = 1,Period = 16,CourseNature = "通识教育课程平台",CourseProperties = "公选课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "975",CourseName = "项目化",Credit = 2,Period = 32,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "987",CourseName = "走进钱学森",Credit = 1,Period = 16,CourseNature = "通识教育课程平台",CourseProperties = "公选课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "686",CourseName = "解析几何",Credit = 3,Period = 48,CourseNature = "学科大类课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "139",CourseName = "近代史",Credit = 2,Period = 32,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "168",CourseName = "刑事法治论",Credit = 3,Period = 48,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 40,UsualWeight = 60 },
                        new Course{ CourseId = "211",CourseName = "行为金融学",Credit = 2,Period = 32,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "544",CourseName = "采煤机驾驶",Credit = 2,Period = 32,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考查",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "626",CourseName = "国际信贷",Credit = 1,Period = 16,CourseNature = "通识教育课程平台",CourseProperties = "公选课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "542",CourseName = "修辞学",Credit = 2,Period = 32,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 },
                        new Course{ CourseId = "048",CourseName = "行为金融学",Credit = 1,Period = 16,CourseNature = "专业核心课",CourseProperties = "必修课",Inspect ="考试",TestWeight = 60,UsualWeight = 40 }
                        } ;

                        foreach (Course item in courses)
                        {
                            await context.courses.AddAsync(item);
                        }
                        foreach (Administrator item in administrtors)
                        {
                            await context.administrators.AddAsync(item);
                        }
                        foreach(College item in colleges)
                        {
                            await context.colledes.AddAsync(item);
                        }
                        foreach (Jurisdiction item in jurisdictions)
                        {
                            await context.jurisdictions.AddAsync(item);
                        }
                        foreach (SystemLog item in systemLogs)
                        {
                            await context.systemLogs.AddAsync(item);
                        }
                        foreach (User item in users)
                        {
                            await context.users.AddAsync(item);
                        }
                        foreach (Teacher item in teachers)
                        {
                            await context.teachers.AddAsync(item);
                        }
                        foreach (Student item in students)
                        {
                            await context.students .AddAsync(item);
                        }
                        foreach (Classes item in classes)
                        {
                            await context.classes.AddAsync(item);
                        }
                        foreach (Major item in majors)
                        {
                            await context.majors .AddAsync(item);
                        }
                        foreach (News item in news)
                        {
                            await context.news.AddAsync(item);
                        }
                        await context.SaveChangesAsync();
                        ConsoleHelper.WriteSuccessLine($"表 Administrator 数据初始化成功!");
                    }


                    ConsoleHelper.WriteInfoLine("初始化数据全部完成!");
                    Console.WriteLine();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
}
